
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.util.ArrayList,
                 com.scalar.chiptrack.users.User,
                 com.scalar.chiptrack.users.Functionality,
                 com.scalar.chiptrack.users.dao.UserDAO,
                 com.scalar.chiptrack.utils.ConfigManager"%>

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/maintainUser.do"/>
<html:html locale="true">

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>

<script language='javascript'>
function search() {
    document.ExternalUserSetupForm.submit();
}
function reset(){
    document.ExternalUserSetupForm.reset();
}

</script>

<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<BODY bgColor='#ffffff' leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">

<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
	<TBODY>
	<TR>
		<td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
			<!-- Side Navigation start -->
			<%@ include file="/jsp/admin/admin_menu.jsp" %>
			<!-- end of the side navigations -->
		</td>
		<TD bgcolor="#ffffff"><IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
		<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
		<TD valign="top" width="100%">
		    <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
		    <BR>
            <!-- from here your body starts -->
            <html:form type="com.scalar.chiptrack.externalusers.forms.ExternalUserSetupForm" action="/externalUserSetup.do?action=search">
            <center><span class="NArialW">Maintain External Users</span></center>
            <img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20>
            <table border="0" width="90%" align=right>
                <tr>
                    <td>
                        <chiptrack:errors styleClass='NArialL' />
                        <chiptrack:info styleClass='NArialL' />
                        <table border="0" width="50%" cellspacing='10' cellpadding='2' align='left'>
                            <tr><td colspan='2'><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
                            <tr>
                                <td colspan='2' nowrap><font class="NArialL">First Name:&nbsp;&nbsp;</font>
                                    <html:text property="searchFirstName" size="25" maxlength="25" styleClass="txfield"/>
                                </td>
                                <td colspan='2' nowrap><font class="NArialL">Last Name:&nbsp;&nbsp;</font>
                                    <html:text property="searchLastName" size="25" maxlength="25" styleClass="txfield"/>
                                </td>
                            </tr>
                            <tr><td colspan='2' nowrap>&nbsp;</td></tr>
                            <tr>
                                <td colspan='2' nowrap align='right'>
                                    <a href="javascript:search()" onMouseOver="window.status='Click to Search for External User';return true" onMouseout="window.status='';return true" title="Click here to Search for External User"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/search.gif" width="53" height="17"></a>
                                </td>
                                <td colspan='2' nowrap align='left'>
                                    <a href="javascript:reset()" onMouseOver="window.status='Click to Reset';return true" onMouseout="window.status='';return true" title="Click here to Reset" ><img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17"></a>
                                </td>
                            </tr>
                         </table>
                    </td>
                </tr>
                <tr><td><img height=10 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"></td></tr>
                <tr>
                    <TD class="NArialL" colspan=5>To add a new external user, please
                        <chiptrack:restrictedLink functionality='<%=Functionality.MAINTAIN_EXTERNAL_USERS%>' action='<%=User.USER_ACTION_MODIFY%>' styleClass="leftsection" href='<%=chipTracContext + "/externalUserSetup.do"%>' onmouseover="window.status='Click to Enter a new External User';return true" onmouseout="window.status='';return true">click here</chiptrack:restrictedLink>
                    </TD>
                </tr>
                <tr>
                    <td>
                    <!-- DISPLAY ALL USERS STARTS HERE -->
                    <%
                        ArrayList userList = (ArrayList) request.getAttribute ("AllExternalUserList");
                        if (userList == null) userList = new ArrayList();
                        if(userList.size()==0){
                    %>
                      <font class="NArialL"><font color="FF0000"><li>External Users: No External User exists for the given search criteria </font></font></td></tr>
                      <%
                        }else{
                      %>
                        <table border="0" width="100%" bordercolor="#FFFFFF" align=right>
                            <tr><td class="NArialL" colspan=5><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
                            <tr>
                                <td width="20%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">External User ID</font></td>
                                <td width="15%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">First Name</font></td>
                                <td width="15%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Last Name</font></td>
                                <td width="40%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Actions</font></font></td>
                                <td width="15%">&nbsp;</td>
                            </tr>

                            <logic:iterate id="allExternalUserList" name="AllExternalUserList" type="com.scalar.chiptrack.externalusers.forms.ExternalUserSetupForm" indexId="index">
                            <bean:define id="i" name="index" />
                            <bean:define id="extUserId" name="allExternalUserList" property="externalUserId"/>
                            <tr>
                                <td nowrap width="15%" align="left" <%if ( Integer.parseInt(i+"")%2 == 0) out.print ("bgcolor='#DEE1E2'");%>>

								<logic:equal name="allExternalUserList" property="disabled" value="true">
									<font class="NArialL"><font color='red'>
										&nbsp;&nbsp;<bean:write name="allExternalUserList" property="externalUserId"/>
									</font></font>
								</logic:equal>
								<logic:equal name="allExternalUserList" property="disabled" value="false">
				                <logic:equal name="allExternalUserList" property="expired" value="true">
                                    <font class="NArialL"><font color='orange'>
                                        &nbsp;&nbsp;<bean:write name="allExternalUserList" property="externalUserId"/>
                                    </font></font>
                                </logic:equal>
								</logic:equal>
								<logic:equal name="allExternalUserList" property="disabled" value="false">
									<logic:equal name="allExternalUserList" property="expired" value="false">
										<font class="NArialL"><font color='black'>
											&nbsp;&nbsp;<bean:write name="allExternalUserList" property="externalUserId"/>
										</font></font>
									</logic:equal>
								</logic:equal>


                                </td>
                                <td nowrap width="15%" align="left" <%if (Integer.parseInt(i+"")%2 == 0) out.print ("bgcolor='#DEE1E2'");%>>
                                     &nbsp;<font class="NArialL"><bean:write name="allExternalUserList" property="firstName"/></font>
                                </td>
                                <td nowrap width="15%" align="left" <%if (Integer.parseInt(i+"")%2 == 0) out.print ("bgcolor='#DEE1E2'");%>>
                                     &nbsp;<font class="NArialL"><bean:write name="allExternalUserList" property="lastName"/></font>
                                </td>
                                <td nowrap width="40%" align="center" <%if (Integer.parseInt(i+"")%2 == 0) out.print ("bgcolor='#DEE1E2'");%>>
                                    <table width="100%">
                                        <tr>
                                            <td width="30%" align=center>
                                                <font class="NArialL">
                                                <chiptrack:restrictedLink functionality='<%=Functionality.MAINTAIN_EXTERNAL_USERS%>' action='<%=User.USER_ACTION_VIEW%>' href='<%="/chiptrack/externalUserSetup.do?action=view&extUserId=" + extUserId %>' onmouseover="window.status='Click to View Exiting External User';return true" onmouseout="window.status='';return true">View </chiptrack:restrictedLink>
                                                </font>
                                            </td>

                                            <td width="30%" align=center>
                                                <font class="NArialL">
                                                    <logic:equal name="allExternalUserList" property="disabled" value="false">
                                                        <chiptrack:restrictedLink functionality='<%=Functionality.MAINTAIN_EXTERNAL_USERS%>' action='<%=User.USER_ACTION_MODIFY%>' href='<%="/chiptrack/externalUserSetup.do?action=modify&extUserId=" + extUserId %>' onmouseover="window.status='Click to Modify Exiting External User';return true" onmouseout="window.status='';return true">Modify</chiptrack:restrictedLink>
                                                    </logic:equal>
                                                    <logic:equal name="allExternalUserList" property="disabled" value="true">
															<font color="red">Modify</font>
                                                    </logic:equal>
                                                </font>
                                            </td>
                                        <td width=30% align=center>
                                        <font class="NArialL">
												<logic:equal name="allExternalUserList" property="disabled" value="false">
													<chiptrack:restrictedLink functionality='<%=Functionality.MAINTAIN_USERS%>' action='<%=User.USER_ACTION_DELETE%>' href='<%="/chiptrack/externalUserSetup.do?action=delete&username=" + extUserId%>' onmouseover="window.status='Click to Disable User';return true" onmouseout="window.status='';return true">Disable</chiptrack:restrictedLink>
												</logic:equal>
												<logic:equal name="allExternalUserList" property="disabled" value="true">
													<chiptrack:restrictedLink functionality='<%=Functionality.MAINTAIN_USERS%>' action='<%=User.USER_ACTION_DELETE%>' href='<%="/chiptrack/externalUserSetup.do?action=activate&username=" + extUserId%>' onmouseover="window.status='Click to Activate User';return true" onmouseout="window.status='';return true"><font color="red">Activate</font></chiptrack:restrictedLink>
												</logic:equal>
                                            </font>
                                        </td>
                                    </tr>
                                    </table>
                                </td>
                                <td width="15%">&nbsp;</td>
                            </tr>
                            </logic:iterate>
                        </table>
                        <%}%>
                    <!-- DISPLAY ALL USERS ENDS HERE -->
                   </td>
                </tr>
	    </table>
	    </html:form>
        <!-- till here -->
    </TD>
	<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
    </TR>
</TABLE>
<br><br><br>
<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</body>
</html:html>

